#ifndef COOKERPLUGINWIDGET_H
#define COOKERPLUGINWIDGET_H

#include "pluginbase.h"

#include <QWidget>
#include <QItemDelegate>
#include <QTableWidgetItem>

namespace Ui {
    class CookerPluginWidget;
}

class QTimer;
class CookerPluginWidget : public ConfigWidgetBase {
    Q_OBJECT
public:
    CookerPluginWidget(PluginConfigBase* cfg, QWidget *parent = 0);
    ~CookerPluginWidget();
    virtual void applyConfigs();
protected:
    void changeEvent(QEvent *e);
public slots:
    void enableSSettings(int);
    void dishRefresh();
    void dishRegreshFinished();
    void showInfo();
    void orderRefrsh();
    void stoveRefresh();

private:
    Ui::CookerPluginWidget *ui;
    QTimer* timer;
};

class CookerConfig;
class DishDelegate : public QItemDelegate
{
    Q_OBJECT
private:
    CookerConfig* cfg;
public:
    DishDelegate(CookerConfig* cfg, QObject *parent = 0)
        : QItemDelegate(parent){this->cfg = cfg;};

    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
                          const QModelIndex &index) const;

    void setEditorData(QWidget *editor, const QModelIndex &index) const;
    void setModelData(QWidget *editor, QAbstractItemModel *model,
                      const QModelIndex &index) const;

    void updateEditorGeometry(QWidget *editor,
        const QStyleOptionViewItem &option, const QModelIndex &index) const;
};


#endif // COOKERPLUGINWIDGET_H
